### 分页模板函数，三个参数含义分别为：当前页、总页数，分页前方的链接
### 具体用法在 Taofinal 中有很多
#define paginate(currentPage, totalPage, link)
#if(totalPage < 2 || currentPage > totalPage)
#return
#end

#setLocal(startPage = currentPage - 3)
#if(startPage < 1)
#setLocal(startPage = 1)
#end

#setLocal(endPage = currentPage + 3)
#if(endPage > totalPage)
#setLocal(endPage = totalPage)
#end

<div style="text-align: center">
    <div class="laypage-main">
        #if(currentPage > 1)
        <a href="#(link)#(currentPage - 1)#(append)">&lt;</a>
        #end
        #if(currentPage - 3 > 1)
        <a href="#(link)1#(append)">1</a>
        #end

        #for(i : [startPage..endPage])
        #if(currentPage == i)
        <span class="laypage-curr">#(i)</span>
        #else
        <a href="#(link)#(i)#(append)">#(i)</a>
        #end
        #end

        #if(currentPage + 3 < totalPage)
        <a href="#(link)#(totalPage)#(append)">#(totalPage)</a>
        #end
        #if(currentPage < totalPage)
        <a href="#(link)#(currentPage + 1)#(append)" class="laypage-next">&gt;</a>
        #end
    </div>
</div>

#end